const wxHttpHandler = require('../../utils/wxHttpHandler.js');
const api = require('../../APIConfig/apiConfig.js');
var app = getApp();
Page({
  data: {
    url:''
  },


  onLoad: function (options) {
    this.getSmallProgramCode()
    wx.setNavigationBarTitle({
      title: '二维码分享',
    })
  },


  //二维码
  getSmallProgramCode: function () {
    let data = {
    }
    const that = this
    wx.showLoading()
    wxHttpHandler({
      type: 'post',
      path: api.getSmallProgramCode,
      data: data,
      fn: function (res) {
        if (res.code == 0) {
          that.setData({
            url: res.data
          })
          wx.hideLoading()
        } else {
          wx.hideLoading()
          wx.showToast({
            title: res.desc,
            icon: 'none',
            duration: 1500,
            mask: true
          });
        }
      }
    })
  },
})